﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace EcSalseManage.SysSetting
{
    public partial class Pwd_Change : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.lblName.Text = Session["EmployeeName"].ToString();
            }
        }

        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            DataAccess.Operate.DA_Login_Inherit Login_Inherit = new DataAccess.Operate.DA_Login_Inherit();
            wsKDHR.Service wsKDHRMS = new wsKDHR.Service();
            string sKDHRID = wsKDHRMS.getEmployeeStatus(Session["EmployeeID"].ToString());

            try
            {
                if (Login_Inherit.changePassword(sKDHRID, this.txtNew1.Text.Trim()))
                {
                    DataAccess.Multi.System_Multi.addLog(Session["EmployeeID"].ToString(), Session["EmployeeName"].ToString(), 4, new Guid(sKDHRID), 2);
                    this.Page.RegisterStartupScript("alert", "<script language=javascript>alert('密码修改成功！');</script>");
                }
                else
                { this.Page.RegisterStartupScript("alert", "<script language=javascript>alert('密码修改失败！');</script>"); }
            }
            catch (System.Exception ex)
            {
                throw new System.Exception(ex.Message.ToString());
            }
            finally
            {
                Login_Inherit = null;
            }
        }
    }
}
